/*--------------------------------------------------------------------------------
	DESCRIPTION: Code to construct all final datasets used for analysis

--------------------------------------------------------------------------------*/

ssc install reghdfe
ssc install ftools
ssc install geo2xy
ssc install outreg2
ssc install nrow
ssc install wbopendata
ssc install wid

global main_dir 	"..." //insert relevant directory of user
global data_dir		"$main_dir/data"
global code_dir		"$main_dir/code"

clear all
set maxvar 50000

//--------------------------------------------------------
//GLOBAL ANALYSIS (HARMONIZED DATASET)
//--------------------------------------------------------

*1) Create harmonized dataset
do "$code_dir/data_creation/creating_harmonized_dataset.do"

*2) Cleaning cross-country datasets
do "$code_dir/data_creation/cleaning_cross_country_datasets.do"

*3) Create lifetime experiences datasets
do "$code_dir/data_creation/creating_lifetime_experiences_datasets.do"

*4) Calculate lifetime experiences
do "$code_dir/data_creation/generating_lifetime_experiences_vars.do"

*5) Create collapsed version of harmonized dataset
do "$code_dir/data_creation/collapsing_harmonized_dataset.do"


//--------------------------------------------------------
//US ANALYSIS (ANES DATA)
//--------------------------------------------------------

*1) Clean ANES
do "$code_dir/data_creation/cleaning_anes.do"

*2) Create final panel with lifetime experience variables
do "$code_dir/data_creation/creating_anes_final_panel.do"


//--------------------------------------------------------
//SWISS ANALYSIS (SWISS HOUSEHOLD PANEL DATA)
//--------------------------------------------------------

*1) Clean relevant variables (wages, CPI, income)
do "$code_dir/data_creation/cleaning_swiss_variables.do"

*2) Clean SHP
do "$code_dir/data_creation/cleaning_shp.do"

*3) Create final panel with lifetime experience variables
do "$code_dir/data_creation/creating_shp_final_panel.do"
